package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.HanoiLabelAddResponse;

/**
 * TOP API: taobao.hanoi.label.add request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class HanoiLabelAddRequest implements TaobaoRequest<HanoiLabelAddResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 认证信息
   */
  private String              appName;

  /**
   * 针对标签的一个简单描述
   */
  private String              description;

  /**
   * 标签的编码，用于检索
   */
  private String              labelCode;

  /**
   * 标签的名称
   */
  private String              name;

  /**
   * 标签是否开放
   */
  private Boolean             open;

  /**
   * 针对模板表达式中需要设置的参数的一个实例化，List<ParameterVO>对象的json格式
   */
  private String              paras;

  /**
   * 标签的使用场景
   */
  private Long                scene;

  /**
   * 标签对应的模板id
   */
  private Long                templateId;

  public void setAppName(String appName) {
    this.appName = appName;
  }

  public String getAppName() {
    return this.appName;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getDescription() {
    return this.description;
  }

  public void setLabelCode(String labelCode) {
    this.labelCode = labelCode;
  }

  public String getLabelCode() {
    return this.labelCode;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getName() {
    return this.name;
  }

  public void setOpen(Boolean open) {
    this.open = open;
  }

  public Boolean getOpen() {
    return this.open;
  }

  public void setParas(String paras) {
    this.paras = paras;
  }

  public String getParas() {
    return this.paras;
  }

  public void setScene(Long scene) {
    this.scene = scene;
  }

  public Long getScene() {
    return this.scene;
  }

  public void setTemplateId(Long templateId) {
    this.templateId = templateId;
  }

  public Long getTemplateId() {
    return this.templateId;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.hanoi.label.add";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("app_name", this.appName);
    txtParams.put("description", this.description);
    txtParams.put("label_code", this.labelCode);
    txtParams.put("name", this.name);
    txtParams.put("open", this.open);
    txtParams.put("paras", this.paras);
    txtParams.put("scene", this.scene);
    txtParams.put("template_id", this.templateId);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<HanoiLabelAddResponse> getResponseClass() {
    return HanoiLabelAddResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(appName, "appName");
    RequestCheckUtils.checkNotEmpty(labelCode, "labelCode");
    RequestCheckUtils.checkNotEmpty(name, "name");
    RequestCheckUtils.checkNotEmpty(templateId, "templateId");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
